<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta name="viewport" id="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no"/>
<title>活动中奖信息</title>
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
</head>

<body>
<div id="recode">

</div>
            <div>
                <p>pageCode<span id="num"> 1 </span></p> 
                  <input id="last" type="button" value="lastPage">
                  <input id="button" type="button" value="nextPage">
                  
            </div>
          



<script type="text/javascript">


$(function(){
	//////////////////////////////////////首次加载
	$.ajax({
				
				url:"http://api.booea.cn:8105/api/recodeList.jsp?n=1",
				type:"get",
				dataType:"json",
				success:function(data){
					var stb = "";
					$.each(data,function(i,items){
						 if(i == "items"){
							var str = "<tr><td>姓名</td><td>地址</td><td>手机</td><td>类型1云南2酒店</td><td>身份证号</td><td>时间</td></tr>";
							 $.each(items,function(j,list){
								 var std = "";
								 $.each(list,function(key,value){
									
									 	std += "<td>"+value+"</td>";
									 })
									 str += "<tr>"+std+"</tr>";
								 })
								 stb += "<table>"+str+"</table>";
							 $("#recode").append(stb);
							 }
						
						})
						//console.log(stb);
						
			
					}
				
	})
/////////////////////////////////

////////////////////////////////////////////下一页
	$('#button').click(function(){
		var numDom=document.getElementById("num");
		var n=parseInt(numDom.innerHTML)+1;
		
		$.ajax({
				
				url:"http://api.booea.cn:8105/api/recodeList.jsp?n="+n+"",
				type:"get",
				dataType:"json",
				success:function(data){
					var stb = "";
					$.each(data,function(i,items){
						 if(i == "items"){
							var str = "<tr><td>姓名</td><td>地址</td><td>手机</td><td>中奖类型</td><td>身份证号</td><td>时间</td></tr>";
							 $.each(items,function(j,list){
								 var std = "";
								 $.each(list,function(key,value){
									
									 	std += "<td>"+value+"</td>";
									 })
									 str += "<tr>"+std+"</tr>";
								 })
								 stb += "<table>"+str+"</table>";
							 $("#recode").html(stb);
							 }
						
						})
						//console.log(stb);
						
				
					}
	})
	
	numDom.innerHTML=n;
		})
///////////////////////////////////////		
		
/////////////////////////////上一页

			$('#last').click(function(){
		var numDom=document.getElementById("num");
		var n=parseInt(numDom.innerHTML)-1;
		
		$.ajax({
				
				url:"http://api.booea.cn:8105/api/recodeList.jsp?n="+n+"",
				type:"get",
				dataType:"json",
				success:function(data){
					var stb = "";
					$.each(data,function(i,items){
						 if(i == "items"){
							var str = "<tr><td>姓名</td><td>地址</td><td>手机</td><td>中奖类型</td><td>身份证号</td><td>时间</td></tr>";
							 $.each(items,function(j,list){
								 var std = "";
								 $.each(list,function(key,value){
									
									 	std += "<td>"+value+"</td>";
									 })
									 str += "<tr>"+std+"</tr>";
								 })
								 stb += "<table>"+str+"</table>";
							 $("#recode").html(stb);
							 }
						
						})
						//console.log(stb);
						
				
					}
	})
	
	numDom.innerHTML=n;
		})
/////////////////////////////////////////////////
		
})
	

</script>
</body>
</html>
